<?php

/**
 * @filename ListAction.class.php 
 * @encoding UTF-8 
 * @author yuzhiyuan <307090870@qq.com>
 * @copyright copyright 2013 (c) Emagsoftware Technology Co., Ltd. All Rights reserved.
 * @license ……
 * @datetime 2013-6-23  0:40:38
 * @version 1.0
 * @Description
  */
class ListAction extends Action {
    public function index(){
    	$id = I('id',intval,0);
        $where = "c_id = ".$id;
        $order = "sort asc,add_time desc";
        $key = md5($where . $order);
        $list = S($key);
        if(false === $list){
            $list = M('Post')->field("blg_post.id as aid,blg_post.title as atitle,blg_post.add_time as aaddtime,blg_user.nickname as bnickname,blg_post.content as acontent,blg_post.titlepic as atitlepic")->order($order)->join('blg_user ON blg_post.u_id = blg_user.id')->where($where)->select();
            S($key,$list);
        }
    	$this->assign('list',$list);
        $this->display();
    }
}